{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# KEGGutils Tutorial 0: KEGGutils basics and KEGG REST API commands\n",
    "## Setup and how to make basic requests to KEGG API using intuitive function calls from within your code\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../img/logo_cut.png\" alt=\"Drawing\" style=\"width: 300px;\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Getting Started\n",
    "\n",
    "### Installing KEGGutils\n",
    "`KEGGutils` is available as a **PyPi** package  and can be easily installed using `pip` via `pip install KEGGutils`,\n",
    "this should be enough to get you going. \n",
    "Alternatively you can visit the project's **Github** https://github.com/filippocastelli/KEGGutils and the **PyPi** page https://pypi.org/project/KEGGutils/ for a manual install."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### First things first\n",
    "Let's import `KEGGutils` with an alias"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os,sys,inspect\n",
    "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n",
    "parentdir = os.path.dirname(currentdir)\n",
    "sys.path.insert(0,parentdir) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import KEGGutils as kg"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "check that the latest version of `KEGGutils` is installed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.3.2\n"
     ]
    }
   ],
   "source": [
    "print(kg.__version__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "we should be ready to go!\n",
    "\n",
    "we can set a directory for our downloaded files, or we can use the default one:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Our default download directory is C:\\Users\\filippo.castelli4\\Documents\\GitHub\\KEGGutils\\tutorials\\kegg_downloads\n"
     ]
    }
   ],
   "source": [
    "print(\"Our default download directory is {}\".format(kg.DOWNLOAD_DIR))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "please notice that the default directory is a runtime variable, remember to **change it every time `KEGGutils` is reloaded** (maybe we'll change that in the future).  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "to ensure that we use the latest available data we can remove all previously downloaded files, if it's your first time using `KEGGutils` you should have no problems."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "> deleting the following files from C:\\Users\\filippo.castelli4\\Documents\\GitHub\\KEGGutils\\tutorials\\kegg_downloads\n",
      "C:\\Users\\filippo.castelli4\\Documents\\GitHub\\KEGGutils\\tutorials\\kegg_downloads\\hsa05215-description\n",
      "C:\\Users\\filippo.castelli4\\Documents\\GitHub\\KEGGutils\\tutorials\\kegg_downloads\\hsa05215-kgml\n",
      "C:\\Users\\filippo.castelli4\\Documents\\GitHub\\KEGGutils\\tutorials\\kegg_downloads\\path-hsa05215-image.png\n"
     ]
    }
   ],
   "source": [
    "kg.delete_cached_files()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The interesting stuff: KEGG REST API"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "KEGGutils provides, among its features, the ability to easily interrogate the KEGG  REST API from within your code without having to explicitly handle HTTP requests: this functionality comes in the form of specific methods for each of the KEGG API commands: \n",
    "\n",
    "+ `keggapi_list()` for the `LIST` API command\n",
    "+ `keggapi_info()` for the `INFO` API command\n",
    "+ `keggapi_find()` for the `FIND` API command\n",
    "+ `keggapi_get()` for the `GET` API command\n",
    "+ `keggapi_conv()` for the `CONV` API command\n",
    "+ `keggapi_link()` for the `LINK` API command\n",
    "+ `keggapi_ddi()` for the `DDI` API command\n",
    "\n",
    "for further infos on what any of the API commands do you can visit [KEGG's API instructions page](https://www.kegg.jp/kegg/rest/keggapi.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KEGG API commands: INFO"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's start from the simplest of them all: the `INFO` instruction that we can easily use with the `keggapi_info()` method."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "KEGG REST API interface for INFO command\n",
      "    Displays information on a given database\n",
      "    \n",
      "    for further info read https://www.kegg.jp/kegg/rest/keggapi.html\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    database : str\n",
      "        database of which you want to obtain infos on\n",
      "    verbose : bool\n",
      "        if set to False displays only the first 4 lines of text (default is True)\n",
      "    force_download :  bool\n",
      "        forces overwriting on previous cached files (default is False)\n",
      "    retutn_format : str\n",
      "        optional, specify a return format to return, str | dict (default is None)\n",
      "        \n",
      "    Returns\n",
      "    -------\n",
      "    info_str : str\n",
      "        optional, plain text response of API INFO command\n",
      "    info_dict : dict\n",
      "        optional, parsed response of API INFO as a dictionary\n",
      "    \n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_info.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It basically displays informations on a given database release, the  databases we can get infos on have to be chosen from the following values:\n",
    "\n",
    "**kegg | pathway | brite | module | ko | genome | genes | vg | ag | ligand | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "we can also request informations on a particular organism code database: \n",
    "let's try to ask infos on the *Homo Sapiens* gene database using the corresponding KEGG **hsa** organism code."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:Infos on hsa from KEGG:\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "T01001           Homo sapiens (human) KEGG Genes Database\n",
      "hsa              Release 90.0+/04-02, Apr 19\n",
      "                 Kanehisa Laboratories\n",
      "                 38,683 entries\n",
      "\n",
      "linked db        pathway\n",
      "                 brite\n",
      "                 module\n",
      "                 ko\n",
      "                 genome\n",
      "                 enzyme\n",
      "                 network\n",
      "                 disease\n",
      "                 drug\n",
      "                 ncbi-geneid\n",
      "                 ncbi-proteinid\n",
      "                 uniprot\n",
      "\n"
     ]
    }
   ],
   "source": [
    "kg.keggapi_info(\"hsa\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "if we wish to have this kind of information packed as a dictionary we can use the  `return_format = \"dict\" ` option:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:Infos on hsa from KEGG:\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "['pathway',\n",
       " 'brite',\n",
       " 'module',\n",
       " 'ko',\n",
       " 'genome',\n",
       " 'enzyme',\n",
       " 'network',\n",
       " 'disease',\n",
       " 'drug',\n",
       " 'ncbi-geneid',\n",
       " 'ncbi-proteinid',\n",
       " 'uniprot']"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hsa_info_dict = kg.keggapi_info(\"hsa\", return_format = \"dict\")\n",
    "\n",
    "hsa_info_dict[\"linked db\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If we want to know what other organism databates are available KEGGutils has a builtin function for displaying a complete list of KEGG organism codes trivially called `get_organism_codes()`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Returns all KEGG Organism name codes \n"
     ]
    }
   ],
   "source": [
    "print(kg.get_organism_codes.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "let's display the first ten organisms"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['hsa', 'ptr', 'pps', 'ggo', 'pon', 'nle', 'mcc', 'mcf', 'csab', 'rro']"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kg.get_organism_codes()[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KEGG API commands: LIST\n",
    "the second command we're gonna see is `LIST`, we can access it using the `keggapi_list()` method."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Interface for the KEGG API LIST command\n",
      "\n",
      "    See https://www.kegg.jp/kegg/rest/keggapi.html for usage\n",
      "\n",
      "    Parameters\n",
      "    ----------\n",
      "    database : str\n",
      "        Database you wish to obtain a list about, one from pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | organism | <medicus>\n",
      "    option : str, optional\n",
      "        'xl' option is applicable only to the 'brite' database for listing binary relation files (the default is None)\n",
      "    want_descriptions : bool, optional\n",
      "        If True returns descriptions for each item (the default is False)\n",
      "    force_download : bool, optional\n",
      "        If true replaces any pre-existing downloaded file (the default is False)\n",
      "    return_url : bool, optional\n",
      "        If True returns the interrogated URL\n",
      "    \n",
      "    Returns\n",
      "    -------\n",
      "    item, descritpions\n",
      "        lists for items and their descriptions\n",
      "    \n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_list.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can use it to easily get list of all entries in a database, `keggapi_list()` lets you optionally choose wether you want to see all the entries with the respective description or you just need a straightforward list of entries with the `want_descriptions` option (not really masters of choosing option names here)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading hsa-list from KEGG at http://rest.kegg.jp/list/hsa\n",
      "INFO:root:succesfully downloaded hsa-list\n"
     ]
    }
   ],
   "source": [
    "hsa_list, descriptions = kg.keggapi_list(database = \"hsa\", want_descriptions = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('hsa:90011',\n",
       "  'KIR3DX1, KIR3DL0, LENG12; killer cell immunoglobulin like receptor, three Ig domains X1'),\n",
       " ('hsa:4549', 'RNR1, MTRNR1, MT-RNR1; s-rRNA'),\n",
       " ('hsa:4550', 'RNR2, MTRNR2, MT-RNR2; l-rRNA'),\n",
       " ('hsa:105369154', 'PKD1P6-NPIPP1; PKD1P6-NPIPP1 readthrough'),\n",
       " ('hsa:401983', 'ZNF847P, gm127; zinc finger protein 847, pseudogene'),\n",
       " ('hsa:101926971', 'LINC01284; long intergenic non-protein coding RNA 1284'),\n",
       " ('hsa:574', 'BAGE, BAGE1, CT2.1; B melanoma antigen'),\n",
       " ('hsa:392133',\n",
       "  'OR10AC1, OR10AC1P; olfactory receptor family 10 subfamily AC member 1 (gene/pseudogene)'),\n",
       " ('hsa:2576', 'GAGE4, CT4.4; G antigen 4'),\n",
       " ('hsa:26581', 'DUX5, DUX1; double homeobox 5')]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(hsa_list, descriptions))[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "we can easily create a dictionary for quick reference with each gene and it's description:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'BAGE, BAGE1, CT2.1; B melanoma antigen'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "genes_dictionary = dict(zip(hsa_list, descriptions))\n",
    "\n",
    "genes_dictionary[\"hsa:574\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "please note that everything you request from KEGG gets saved under`kegg_download_dir` in plain text for easy retrieval when you don't have internet connection or simply don't want to wait for another HTTP request.\n",
    "\n",
    "The next time we'll call `keggapi_list()` or any of the methods we're preenting in this tutorial `KEGGutils` will automatically read the same cached copy from disk:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING:root:> File hsa-list already present in C:\\Users\\filippo.castelli4\\Documents\\GitHub\\KEGGutils\\tutorials\\kegg_downloads\n",
      "reading from chached file...\n"
     ]
    }
   ],
   "source": [
    " hsa_list = kg.keggapi_list(database = \"hsa\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "unless we explicitly want a fresh copy, and we can request it using the `force_download` option:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading hsa-list from KEGG at http://rest.kegg.jp/list/hsa\n",
      "INFO:root:succesfully downloaded hsa-list\n"
     ]
    }
   ],
   "source": [
    " hsa_list = kg.keggapi_list(database = \"hsa\", force_download = True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KEGG API commands: FIND\n",
    "The `FIND` functionality is readily avilable using `keggapi_find()`\n",
    "\n",
    "This is one of the most interesting KEGG API funcionalities: it's a search operation that looks for a query in all of a given database entries an associated fields"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Interface for the KEGG API FIND command\n",
      "    \n",
      "    See https://www.kegg.jp/kegg/rest/keggapi.html for further info\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    database : str\n",
      "        KEGG database you wish to query on, one from pathway | brite | module | ko | genome | genes | <org> | vg | ag | ligand | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | <medicus>  \n",
      "    query : str\n",
      "        Desired query\n",
      "    option : str, optional\n",
      "        if database is \"compound\" or \"drug\", possible options are \"formula\", \"exact mass\" and \"mol_weight\" (the default is None)\n",
      "    want_descriptions : bool, optional\n",
      "        if set to True returns a list of descriptions for the found items (the default is False,)\n",
      "    verbose : bool, optional\n",
      "        if set to True displays additional messages (the default is False)\n",
      "    force_download : bool, optional\n",
      "        if set to True replaces any previously downloaded file under the same name (the default is False)\n",
      "    return_url : bool, optional\n",
      "        If True returns the interrogated URL\n",
      "    Returns\n",
      "    -------\n",
      "    list, list\n",
      "        list of items and descriptions\n",
      "    \n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_find.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We may be interested on knowing which *Escherichia Coli* genes code for [*Shiga toxins*](https://en.wikipedia.org/wiki/Shiga_toxin), we can perform a search on all genes for the words *shiga toxin*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('ece:Z1464',\n",
       "  'stx2A; shiga-like toxin II A subunit encoded by bacteriophage BP-933W'),\n",
       " ('ece:Z1465',\n",
       "  'stx2B; shiga-like toxin II B subunit encoded by bacteriophage BP-933W'),\n",
       " ('ece:Z3343',\n",
       "  'stx1B; shiga-like toxin 1 subunit B encoded within prophage CP-933V'),\n",
       " ('ece:Z3344',\n",
       "  'stx1A; shiga-like toxin 1 subunit A encoded within prophage CP-933V'),\n",
       " ('ecs:ECs1205', 'Shiga toxin 2 subunit A'),\n",
       " ('ecs:ECs1206', 'Shiga toxin 2 subunit B'),\n",
       " ('ecs:ECs2973', 'Shiga toxin I subunit B'),\n",
       " ('ecs:ECs2974', 'Shiga toxin I subunit A'),\n",
       " ('ecf:ECH74115_2905', 'shigatoxin 2, subunit B'),\n",
       " ('ecf:ECH74115_2906', 'shiga toxin subunit A')]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gene_list, descriptions = kg.keggapi_find(database = \"genes\",\n",
    "                                          query = \"shiga toxin\",\n",
    "                                          want_descriptions = True)\n",
    "\n",
    "list(zip(gene_list, descriptions))[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "we can easily verify that the found gene codes are from various E. Coli subspecies using `keggapi_info` on the database identifier `ece`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:Infos on ece from KEGG:\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "T00044           Escherichia coli O157 H7 EDL933 (EHEC) KEGG Genes Database\n",
      "ece              Release 90.0+/03-30, Mar 19\n",
      "                 Kanehisa Laboratories\n",
      "                 5,579 entries\n",
      "\n",
      "linked db        pathway\n",
      "                 brite\n",
      "                 module\n",
      "                 ko\n",
      "                 genome\n",
      "                 enzyme\n",
      "                 ncbi-proteinid\n",
      "                 uniprot\n",
      "\n"
     ]
    }
   ],
   "source": [
    "kg.keggapi_info(\"ece\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Another useful example of the ways we can use the `FIND` funcionality is searching registered compounds matching the chemical formula of [*Shikimic Acid*](*https://en.wikipedia.org/wiki/Shikimic_acid) *C7H10O5*:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('cpd:C00493', 'C7H10O5'),\n",
       " ('cpd:C04236', 'C7H10O5'),\n",
       " ('cpd:C16588', 'C7H10O5'),\n",
       " ('cpd:C17696', 'C7H10O5'),\n",
       " ('cpd:C18307', 'C7H10O5'),\n",
       " ('cpd:C18312', 'C7H10O5'),\n",
       " ('cpd:C20961', 'C7H10N2O5'),\n",
       " ('cpd:C21281', 'C7H10O5')]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "compounds, formulas = kg.keggapi_find(database = \"compound\",\n",
    "                                          query = \"C7H10O5\",\n",
    "                                          option = \"formula\",\n",
    "                                          want_descriptions = True)\n",
    "\n",
    "list(zip(compounds, formulas))[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KEGG API commands: GET"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This is probably the most used command in the whole series, you can use it by calling `keggapi_get()`.\n",
    "I'ts use to retrieve any KEGG database entry in a variety of formats:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Interface for the KEGG API GET command\n",
      "\n",
      "    for further info read https://www.kegg.jp/kegg/rest/keggapi.html\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    dbentry : str\n",
      "        KEGG database entry you wish to GET, one from pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | disease_ja | drug_ja | dgroup_ja | environ_ja | compound_ja\n",
      "    option : str, optional\n",
      "        one from aaseq | ntseq | mol | kcf | image | conf | kgml | json (the default is None])\n",
      "    want_descriptions : bool, optional\n",
      "        if True returns a list of descriptions for the requested items (the default is False)\n",
      "    verbose : bool, optional\n",
      "        is True displays additional messages  (the default is True)\n",
      "    force_download : bool, optional\n",
      "        if set to True replaces any file under the same filename (the default is False)\n",
      "    show_result_image: boo, optional\n",
      "        if set to True shows the downloaded image (the default is True)\n",
      "    return_dic : bool, optional\n",
      "        if set to True, returns description in dict format\n",
      "    return_url : bool, optional\n",
      "        If True returns the interrogated URL\n",
      "        \n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_get.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "easiest case: we want to identify what entry `ecs:ECs1206` could possibly be, we can easy ask the KEGG database using the following command"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Infos on ecs:ECs1206 from KEGG:\n",
      "\n",
      "DEFINITION  (RefSeq) Shiga toxin 2 subunit B\n",
      "ORTHOLOGY   K11007  shiga toxin subunit B\n",
      "ORGANISM    ecs  Escherichia coli O157:H7 Sakai (EHEC)\n"
     ]
    }
   ],
   "source": [
    "kg.keggapi_get(dbentry = \"ecs:ECs1206\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "if knowing definition, orthology and organism is not enough for us, we can use the `verbose` option that will tell us life, death and miracles about `ecs:ECs1206`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Infos on ecs:ECs1206 from KEGG:\n",
      "\n",
      "ENTRY       ECs1206           CDS       T00048\n",
      "DEFINITION  (RefSeq) Shiga toxin 2 subunit B\n",
      "ORTHOLOGY   K11007  shiga toxin subunit B\n",
      "ORGANISM    ecs  Escherichia coli O157:H7 Sakai (EHEC)\n",
      "PATHWAY     ecs02024  Quorum sensing\n",
      "            ecs05130  Pathogenic Escherichia coli infection\n",
      "MODULE      ecs_M00363  EHEC pathogenicity signature, Shiga toxin\n",
      "BRITE       KEGG Orthology (KO) [BR:ecs00001]\n",
      "             09140 Cellular Processes\n",
      "              09145 Cellular community - prokaryotes\n",
      "               02024 Quorum sensing\n",
      "                ECs1206\n",
      "             09160 Human Diseases\n",
      "              09171 Infectious diseases: Bacterial\n",
      "               05130 Pathogenic Escherichia coli infection\n",
      "                ECs1206\n",
      "             09180 Brite Hierarchies\n",
      "              09183 Protein families: signaling and cellular processes\n",
      "               02042 Bacterial toxins [BR:ecs02042]\n",
      "                ECs1206\n",
      "            Bacterial toxins [BR:ecs02042]\n",
      "             Type III toxins: Intracellular toxins\n",
      "              Others\n",
      "               Shiga toxin\n",
      "                ECs1206\n",
      "POSITION    1267936..1268205\n",
      "MOTIF       Pfam: SLT_beta Peptidase_C28 DUF2541 Porin_7 PCC_BT\n",
      "DBLINKS     NCBI-GeneID: 912579\n",
      "            NCBI-ProteinID: NP_309233\n",
      "            UniProt: A7UQX3\n",
      "STRUCTURE   PDB: 4M1U 1R4P 3MXG\n",
      "AASEQ       89\n",
      "            MKKMFMAVLFALASVNAMAADCAKGKIEFSKYNEDDTFTVKVDGKEYWTSRWNLQPLLQS\n",
      "            AQLTGMTVTIKSSTCESGSGFAEVQFNND\n",
      "NTSEQ       270\n",
      "            atgaagaagatgtttatggcggttttatttgcattagcttctgttaatgcaatggcggcg\n",
      "            gattgtgctaaaggtaaaattgagttttccaagtataatgaggatgacacatttacagtg\n",
      "            aaggttgacgggaaagaatactggaccagtcgctggaatctgcaaccgttactgcaaagt\n",
      "            gctcagttgacaggaatgactgtcacaatcaaatccagtacctgtgaatcaggctccgga\n",
      "            tttgctgaagtgcagtttaataatgactga\n",
      "///\n",
      "\n"
     ]
    }
   ],
   "source": [
    "kg.keggapi_get(dbentry = \"ecs:ECs1206\", verbose = True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "the same data is available as a dict selecting the `return_dict` option"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'entry': {'descr': 'ECs1206           CDS       T00048'},\n",
       " 'definition': {'descr': '(RefSeq) Shiga toxin 2 subunit B'},\n",
       " 'orthology': {'descr': 'K11007  shiga toxin subunit B'},\n",
       " 'organism': {'descr': 'ecs  Escherichia coli O157:H7 Sakai (EHEC)'},\n",
       " 'pathway': {'descr': 'ecs05130  Pathogenic Escherichia coli infection'},\n",
       " 'module': {'descr': 'ecs_M00363  EHEC pathogenicity signature, Shiga toxin'},\n",
       " 'brite': {'descr': 'ECs1206'},\n",
       " 'position': {'descr': '1267936..1268205'},\n",
       " 'motif': {'descr': 'Pfam: SLT_beta Peptidase_C28 DUF2541 Porin_7 PCC_BT'},\n",
       " 'dblinks': {'descr': 'UniProt: A7UQX3'},\n",
       " 'structure': {'descr': 'PDB: 4M1U 1R4P 3MXG'},\n",
       " 'aaseq': {'descr': 'AQLTGMTVTIKSSTCESGSGFAEVQFNND'}}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kg.keggapi_get(dbentry = \"ecs:ECs1206\", return_dict = True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "among the various perks of the `GET` functionality is the ability to easily request amminoacid sequences using the `aaseq` option"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading ecs-ECs1206-aaseq from KEGG at http://rest.kegg.jp/get/ecs:ECs1206/aaseq\n",
      "INFO:root:succesfully downloaded ecs-ECs1206-aaseq\n"
     ]
    }
   ],
   "source": [
    "description, sequence = kg.keggapi_get(dbentry = \"ecs:ECs1206\",\n",
    "                                       option = \"aaseq\",\n",
    "                                       want_descriptions = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MKKMFMAVLFALASVNAMAADCAKGKIEFSKYNEDDTFTVKVDGKEYWTSRWNLQPLLQSAQLTGMTVTIKSSTCESGSGFAEVQFNND\n"
     ]
    }
   ],
   "source": [
    "print(sequence)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "or we can easily see what a given compound formula looks like using the `image option`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading C00002-image from KEGG at http://rest.kegg.jp/get/C00002/image\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAACVCAYAAABWxTFzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X9YVGX6P/D3DYipKJryK5MkM5PthwmarT9aNRPRMNsgDYXFz4aXu21q3621vArlU1ermbVm37JUMgFTs5QtKdNwzbVE9KumkAGuBv4CVw1DwBm4v38wQwPMwPw4Z86Z8X5d17mYec7Mee7jwXsennme8xAzQwghhPfy0ToAIYQQ6pJEL4QQXk4SvRBCeDlJ9EII4eUk0QshhJeTRC+EEF5OtURPRDFEdJyISohovlr1CCGEaBupMY6eiHwB/AhgHIByAPsBTGPmQsUrE0II0Sa1WvRDAZQw8wlmvgbgIwCTVapLCCFEG/xUOm5vAGUWz8sB3Gfrxb169eK+ffuqFIoQQninAwcOXGDmoPZep1aiJytlzfqIiCgVQCoAhIeHo6CgQKVQhBDCOxHRKXtep1bXTTmAPhbPbwZwxvIFzPweM0czc3RQULsfSEIIIZykVqLfD6A/EUUQkT+AqQByVKpLCCFEG1TpumFmIxE9BeBLAL4A1jDzMTXqEkII0Ta1+ujBzNsAbFPr+EIIIewjM2OFEMLLSaIXQggvJ4leCCG8nCR6IYTwcpLohRC6YDAY0NDQYHUfM8NgMLg5Iu8hiV4IoQshISEYNWqU1WSfk5ODwMBADaLyDpLohRC6kZ+fj2XLlmkdhteRRC+E0I158+Zh4cKFKCoq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gghvJwkeiGE8HKS6IUQwsv9f4jgdM4yi9uBAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "img = kg.keggapi_get(dbentry = \"C00002\",\n",
    "              option = \"image\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "graphical descriptions are also available for **pathways** "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading hsa05130-image from KEGG at http://rest.kegg.jp/get/hsa05130/image\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAASgAAAD8CAYAAADE3zmUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAHtRJREFUeJztnW/sJdV53z9P18F/IMiQANo/UGNpGwcqtfb+RE1cJWxICnWX4DdIRHJLKqqVKto6aat4t3mx+3uBRNvISqvKVldOUtrYRitileWnpA6li/LGAf82dhqWNWEdLNjsBtatlFh5gQ19+uLOrGdnz8yc+XPnnpn7/UhXd+658+fcuTPfec5znvMcc3eEECJF/tqqKyCEEFVIoIQQySKBEkIkiwRKCJEsEighRLJIoIQQyTK6QJnZvWb2spmdNbNDYx9fCDEdbMw4KDPbAfwJ8LPAOeBrwM+7+0ujVUIIMRnGtqDuAM66+5+6+/eAJ4D7R66DEGIivGvk4+0GXi98Pgf8nfJKZnYQOAhw9dVX7/vQhz40Tu2EEKPw7W9/m+985zvWtN7YAhWq0BVtTHc/BhwD2NjY8O3t7WXXSwgxIhsbG1Hrjd3EOwfcXPi8Bzg/ch2EEBNhbIH6GrDX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Pxq8DZ9z9M4WvWuXGWnY93f2wu+9x9w+wOG//y90/mVo9s7r+OfC6mf1YVnQ3i1Q9qdX1NeCjZva+7Dq4GziTYD2LrCxn26Cs2glW4/T7OIuesm8Bv5JAff4uC5P3fwPfyF4fB36EhUP6lez9+sI2v5LV/2VW0CPCIo9X7iRPsp7A3wa2s/P634HrUqwrsAl8E3gR+G8sesGSqCfwJRa+se+zsIQe7lI3YCP7fd8C/hOlzotVvDTURQiRLKk28YQQQgIlhEgXCZQQIlkkUEKIZJFACSGSRQIlhEgWCZQQIln+P8n4lQfRptM5AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "e_coli_infection_pathway_img = kg.keggapi_get(dbentry = \"hsa05130\", option = \"image\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The inline image preview is a bit small but you can always use the iPython magic `%matplotlib notebook` to use mainteractive visualization mode."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "But `GET` can offer us much more than just visualizing pathways, we can obtain (almost) full descriptions in the form of [KGML xml files](https://www.kegg.jp/kegg/xml/) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "kgml = kg.keggapi_get(dbentry = \"hsa05130\", option = \"kgml\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Once downloaded the `xml` file, `KEGGutils` automatically converts it to an `XML ElementTree` for easy manipulation and interrogation, here we just look for the title of the pathway, the KEGG corresponding description url and a link to a graphical representation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pathway Title:\n",
      "Pathogenic Escherichia coli infection\n",
      "Pathway link:\n",
      "http://www.kegg.jp/kegg-bin/show_pathway?hsa05130\n",
      "Pathway image link:\n",
      "http://www.kegg.jp/kegg/pathway/hsa/hsa05130.png\n"
     ]
    }
   ],
   "source": [
    "print(\"Pathway Title:\")\n",
    "print(kgml.getroot().get('title'))\n",
    "print(\"Pathway link:\")\n",
    "print(kgml.getroot().get('link'))\n",
    "print(\"Pathway image link:\")\n",
    "print(kgml.getroot().get('image'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**note** `KEGGutils` also features a full dedicated class for parsing, storing `.xml` `KGML-style` pathways and converting them to easily usable `networkx` Graph, that's called `KEGGpathway`and we'll see it in a different tutorial."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KEGG API commands: LINK\n",
    "\n",
    "Ok, we have very nice lists of stuff and several ways to get information of each and every one of the list elements, but the really interesting part is getting to know how it's all tangled together, here comes to the resecue the `LINK` functionality: KEGG `LINK` functionality is used to view the interaction links between two different databases and it's accessible via `keggapi_link()`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Interface for the KEGG REST API LINK command \n",
      "    Given two different database names returns the linked relations between them\n",
      "    \n",
      "    for further info read https://www.kegg.jp/kegg/rest/keggapi.html\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    source : str\n",
      "        source database name\n",
      "    target : str\n",
      "        target database name\n",
      "    verbose : bool, optional\n",
      "        displays additional infos during the download (the default is True)\n",
      "    force_download : bool, optional\n",
      "        forces overwriting over cached files (the default is False)\n",
      "    return_url : bool, optional\n",
      "        If True returns the interrogated URL\n",
      "        \n",
      "    Raises\n",
      "    ------\n",
      "    KEGGKeyError\n",
      "        if a database key is invalid\n",
      "    \n",
      "    Returns\n",
      "    -------\n",
      "    link1 : list\n",
      "        list of source nodes\n",
      "    link2 : list\n",
      "        list of target nodes\n",
      "    \n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_link.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Given two different databases `keggapi_link()` will just return every link that exists between their components"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading enzyme-hsa-link from KEGG at http://rest.kegg.jp/link/enzyme/hsa\n",
      "INFO:root:succesfully downloaded enzyme-hsa-link\n"
     ]
    }
   ],
   "source": [
    "genes, enzymes = kg.keggapi_link(\"hsa\", \"enzyme\" )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "in the form of two lists that we can easily zip together to create another list, a dict, or whatever we want to create"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('hsa:9344', 'ec:2.7.11.1'),\n",
       " ('hsa:5894', 'ec:2.7.11.1'),\n",
       " ('hsa:673', 'ec:2.7.11.1'),\n",
       " ('hsa:5607', 'ec:2.7.12.2'),\n",
       " ('hsa:5598', 'ec:2.7.11.24'),\n",
       " ('hsa:9020', 'ec:2.7.11.25'),\n",
       " ('hsa:51701', 'ec:2.7.11.24'),\n",
       " ('hsa:64840', 'ec:2.3.1.250'),\n",
       " ('hsa:495', 'ec:7.2.2.19'),\n",
       " ('hsa:496', 'ec:7.2.2.19')]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(genes, enzymes))[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KEGG API commands: CONV\n",
    "\n",
    "In an integrated workflow we may want to use different databases other thank just KEGG, how can we make them talk the same language? We use the `CONV` functionality that `KEGGutils` exposes via `keggapi_conv()`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " KEGG REST API interface to CONV command\n",
      "    Converts KEGG codes to and from NCBI ProteinID, NCBI GeneID, Uniprot, CHEBI    and PubChem name standards\n",
      "    \n",
      "    for further info read https://www.kegg.jp/kegg/rest/keggapi.html\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    \n",
      "    source str :\n",
      "        source database or dbentry\n",
      "    target str :\n",
      "        target database or dbentry\n",
      "    verbose bool : \n",
      "        if set to True displays additional messages (defaultis True)\n",
      "    force_download bool: \n",
      "        forces overwriting cached files (default is False)\n",
      "    return_url : bool, optional\n",
      "        If True returns the interrogated URL        \n",
      "    Returns\n",
      "    -------\n",
      "    \n",
      "    source_codes : list\n",
      "        list of codes in the original database format\n",
      "    target_codes : list\n",
      "        list of codes in the target database format\n",
      "    \n",
      "    \n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_conv.__doc__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The method basically lets you convert to and from external link identifiers single entries or even entire databases: \n",
    "\n",
    "Here we want to get a correspondence between the KEGG style `eco` E. Coli genes and their names in the [NCBI GeneID format](https://www.ncbi.nlm.nih.gov/gene)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading eco-ncbi-geneid-conv from KEGG at http://rest.kegg.jp/conv/eco/ncbi-geneid\n",
      "INFO:root:succesfully downloaded eco-ncbi-geneid-conv\n"
     ]
    }
   ],
   "source": [
    "ncbi_genes, kegg_genes_eco = kg.keggapi_conv(\"ncbi-geneid\", \"eco\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "in one line we've retrieved the full correspondences between the two formats"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('ncbi-geneid:944742', 'eco:b0001'),\n",
       " ('ncbi-geneid:945803', 'eco:b0002'),\n",
       " ('ncbi-geneid:947498', 'eco:b0003'),\n",
       " ('ncbi-geneid:945198', 'eco:b0004'),\n",
       " ('ncbi-geneid:944747', 'eco:b0005'),\n",
       " ('ncbi-geneid:944749', 'eco:b0006'),\n",
       " ('ncbi-geneid:944745', 'eco:b0007'),\n",
       " ('ncbi-geneid:944748', 'eco:b0008'),\n",
       " ('ncbi-geneid:944760', 'eco:b0009'),\n",
       " ('ncbi-geneid:944792', 'eco:b0010')]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(ncbi_genes, kegg_genes_eco))[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If we don't need a full database we can just request for a single entry conversion "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:> Downloading genes-ncbi-geneid-19831932-conv from KEGG at http://rest.kegg.jp/conv/genes/ncbi-geneid:19831932\n",
      "INFO:root:succesfully downloaded genes-ncbi-geneid-19831932-conv\n"
     ]
    }
   ],
   "source": [
    "ncbi, kegg_eco = kg.keggapi_conv(\"ncbi-geneid:19831932\", \"genes\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ncbi-geneid:19831932 NCBI gene is called lpn:lpg0366 in KEGG \n"
     ]
    }
   ],
   "source": [
    "print(\"{} NCBI gene is called {} in KEGG \".format(ncbi[0], kegg_eco[0]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## KEGG API commands: DDI\n",
    "\n",
    "The last of the KEGG API commands is called `DDI` that stands for *Drug-Drug Interaction* and searches for adverse drug-drug interaction for a given drug identifier, we can use it with  the `keggapi_ddi()` method."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "KEGG REST API interface for the DDI command\n",
      "    lists drug-drug interactions for a given compound name\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    \n",
      "    dbentry : str\n",
      "        drug KEGG database entry\n",
      "    force_download : bools\n",
      "        forces overwriting over cached files (default is False)\n",
      "    return_url : bool, optional\n",
      "        If True returns the interrogated URL        \n",
      "    for further info read https://www.kegg.jp/kegg/rest/keggapi.html\n"
     ]
    }
   ],
   "source": [
    "print(kg.keggapi_ddi.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "ddi_list = kg.keggapi_ddi(\"D00564\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('dr:D00564', 'cpd:C00304', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C01946', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C04931', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C06624', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C07005', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C07314', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C07370', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C07506', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C07521', 'P', 'unclassified'),\n",
       " ('dr:D00564', 'cpd:C11368', 'P', 'unclassified')]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ddi_list[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "we can see our search has returned the original drug, the interacting compound or drug, a type of interaction clasified by controindication (CI) or precaution (P) and an additional classifier tag."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This concludes the overview of KEGG API command mehtod in `KEGGutils`, the many other features will be explained in other tutorials"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
